script_enemy_main
{
        let csd     = GetCurrentScriptDirectory;
	let speed = GetSpeed;
	let angle = GetAngle;
	let num = GetArgument;
	let imgEnemy;
	if(num==1)
	{
		imgEnemy=csd~"..\lib\fairy_red.png";
	}
	if(num==2)
	{
		imgEnemy=csd~"..\lib\fairy_blue.png";
	}
	let imgCircle=csd~"..\img\circle.png";
	let SelectedDifficult=GetCommonDataDefault("SELECTEDDIFFICULT","Normal");

    @Initialize {
        SetLife(500);
        SetDamageRate(100,100);
	SetTexture(imgEnemy);
	Initialize_Fairy(7);
	Tmain;
	}

    @MainLoop {
	BulletNum=GetEnemyShotCount;
	SetCollisionA(GetX(),GetY(),48);
	yield;
    }

        @DrawLoop {
		SetColor(ZakoColor[0],ZakoColor[1],ZakoColor[2]);
		DrawFairy(imgEnemy);
		DrawMagicCircle("WHITE",0.50);
	}

        @Finalize
        {
		MagicCircleBreak(GetX,GetY,1,0.5);
		FinalizeItemAndShotnumWithDelete(3);
        } 

task Tmain
{
yield;
Stage3FairyCommonTask;
OutDamageRateZero;
AutoErazeTime(1200);
GetDamege;
MagicColor;
move;

alternative(GetCommonDataDefault("SELECTEDDIFFICULT","None"))
case("Moderate")
{
shotM;
}
case("Extream")
{
shotE;
}
case("Apocalypse")
{
shotA;
}

}


task move
{
	SetSpeed(GetSpeed);
	SetAngle(GetAngle);
	wait(180);
	SetSpeed(GetSpeed/5);
	SetAngle(GetAngle+180);
}

task shotM
{
wait(60);
while(GetLife>250)
{
let angle=GetAngleToPlayer;
ascent(let i in 0..12)
{
	GroundCreateShot01(GetX,GetY,3.5,angle+i*30,9,5);
}
	GroundCreateShot01(GetX,GetY,3.5,angle+10,9,5);
	GroundCreateShot01(GetX,GetY,3.5,angle+5,9,5);
	GroundCreateShot01(GetX,GetY,3.5,angle-10,9,5);
	GroundCreateShot01(GetX,GetY,3.5,angle-5,9,5);
wait(30);
}
Concentration01(30);
loop
{
	let angle=rand(0,360);
	ascent(let i in 0..24)
	{
		GroundCreateShot01(GetX,GetY,3.5,angle+i*15,9,5);
	}
	wait(15);
}

}
/////////////////////////////////////////////
task shotE
{
wait(60);
while(GetLife>250)
{
let angle=GetAngleToPlayer;
ascent(let i in 0..12)
{
	GroundCreateShot01(GetX,GetY,3.5,angle+i*30,9,5);
}
	loop(5)
	{
	GroundCreateShot01(GetX,GetY,3.5,angle+10,9,5);
	GroundCreateShot01(GetX,GetY,3.5,angle+5,9,5);
	GroundCreateShot01(GetX,GetY,3.5,angle,9,5);
	GroundCreateShot01(GetX,GetY,3.5,angle-10,9,5);
	GroundCreateShot01(GetX,GetY,3.5,angle-5,9,5);
	wait(3);
	}
wait(15);
}
Concentration01(30);
loop
{
	let angle=rand(0,360);
	ascent(let i in 0..30)
	{
		GroundCreateShot01(GetX,GetY,3.5,angle+i*12,9,5);
	}
	wait(10);
}
}
////////////////////////////////////////////////
task shotA
{
wait(60);
while(GetLife>250)
{
let angle=GetAngleToPlayer;
	loop(5)
	{
ascent(let i in 0..24)
{
	GroundCreateShot01(GetX,GetY,4.5,angle+i*15,9,5);
}
	wait(3);
	}
wait(15);
}
Concentration01(30);
loop
{
	let angle=rand(0,360);
	ascent(let i in 0..72)
	{
		GroundCreateShot01(GetX,GetY,4.5,angle+i*5,9,5);
	}
	wait(10);
}

}

#include_function ".\..\txt/StageEnemydata.txt"
#include_function ".\..\txt/Stage3FairyCommondata.txt"
#include_function ".\..\lib\lib_anime_fairy.txt"
}

#include_script ".\..\txt/EnemyShotData.txt"